package schoolbolg_gh326.service;



import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;

public class MyService { 
	private UserService userService;
	private BlogService blogService;
//	private VideosService videoService;
	private static Retrofit retrofit;
	private static MyService service;
	private Call<String> call;
	public MyService(String baseURL,String gson) {
		// TODO Auto-generated constructor stub
		
		if(gson.equals("string")){
			retrofit = new Retrofit.Builder()
			.baseUrl(baseURL)
			.addConverterFactory(ScalarsConverterFactory.create())
			.build();
		}		
		else{
			retrofit = new Retrofit.Builder()
			.baseUrl(baseURL)
			.addConverterFactory(GsonConverterFactory.create())
			.build();
		}
		userService = retrofit.create(UserService.class);
		blogService = retrofit.create(BlogService.class);
	//	videoService = retrofit.create(VideosService.class);
		
	}
	public static MyService getInstance(String baseURL,String gson){
		if(service==null){
			service =new MyService(baseURL,gson);
		}
		return service;
	}
	public UserService getUserService() {
		return userService;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	public BlogService getblogService() {
		return blogService;
	}
	public void setWeiboService(BlogService weiboService) {
		this.blogService = weiboService;
	}
	/*public VideosService getVideoService() {
		return videoService;
	}
	public void setVideoService(VideosService videoService) {
		this.videoService = videoService;
	}*/

}